import { showLoading, toastSuccess } from "../../util/ToastUtil";
import loginWxCodeApi from "../../api/user/loginWxCodeApi";
import StorageKey from "../../util/StorageKey";
Page({
    data: {
    },
    bindgetphonenumber(e: { detail: { code: string; }; }) {
        const phoneCode = e.detail.code
        if (!phoneCode) {
            return
        }
        showLoading()
        wx.login({
            success(res) {
                if (res.code) {
                    loginWxCodeApi({ phoneCode, code: res.code }).then(res => {
                        wx.setStorageSync(StorageKey.JWT, res.data)
                        wx.navigateBack()
                        toastSuccess(res.msg)
                    })
                }
            }
        })
    }
})